package fhj.swd09.resteasy;

public class Fact 
{
	//Property text:String
	private String text;
	public String getText() 
	{
		return text;
	}
	public void setText(String text) 
	{
		this.text = text;
	}
	
	//Property favourite:boolean
	private boolean favourite;
	public boolean isFavourite() 
	{
		return favourite;
	}
	public void setFavourite(boolean favourite) 
	{
		this.favourite = favourite;
	}
	
	//Methods
	public String toHtml()
	{
		StringBuilder htmlout = new StringBuilder();
		
		htmlout.append("<b>").append(text).append("</b>").append("</br>");
		htmlout.append("favourite: ");
		if (this.isFavourite())
		{
			htmlout.append("yes");
		}
		else
		{
			htmlout.append("no");
		}
		htmlout.append("</br></br>");
		
		return htmlout.toString();
	}
	
	public String toText()
	{
		StringBuilder textout = new StringBuilder();
		
		textout.append(text).append("\n");
		textout.append("favourite: ");
		if (this.isFavourite())
		{
			textout.append("yes");
		}
		else
		{
			textout.append("no");
		}
		textout.append("\n\n");
		
		return textout.toString();
	}
}
